package dnl.jexem.cmd;

/**
 * A factory that centralizes <code>CommandExecution</code> creation.
 *
 * @author Daniel Orr
 *
 */
public class CommandExecutionFactory {

    /**
     * Creates a <code>CommandExecution</code> that will execute a command locally.
     *
     * @param command
     * @return
     */
    public static LocalCommandExcecution createLocalCommandExecution(String... command) {
        LocalCommandExcecution commandRunner = new LocalCommandExcecution(command);
        return commandRunner;
    }

    /**
     * Creates a <code>CommandExecution</code> that will execute a command locally.
     *
     * @param command
     * @return
     */
    public static LocalCommandExcecution createLocalCommandExecution(Command command) {
        LocalCommandExcecution commandRunner = new LocalCommandExcecution(command);
        return commandRunner;
    }

    /**
     * Executes the given <code>String</code> as a local script.
     *
     * @param script
     * @return
     */
    public static LocalCommandExcecution createLocalCommandExecutionAsScript(String script) {
        LocalExecutionAsScript commandRunner = new LocalExecutionAsScript(script);
        return commandRunner;
    }
}
